<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
    <script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
    <script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
    <script src="/res/third/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="/res/third/easyUI/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script type="text/javascript" src="/res/third/layer/layer.js"></script>
    <script type="text/javascript">
        function sosuo(){
            var lpath =location.pathname;
            var pageNo = $("#pageNo").val();
            $("#soform").attr("action",lpath+"?pageNo="+pageNo);
            $("#soform").submit();
        }

        function thaw(payNumber) {
            layer.confirm('是否确认解冻？', {icon: 3, title: '提示'}, function (index) {
                var loader;
                $.ajax({
                    url : '/pingan/thaw.do',
                    type : 'post' ,
                    data : {payNumber:payNumber},
                    beforeSend : function () {
                        layer.close(index);
                        loader = layer.load(2);
                    },
                    dataType : 'json',
                    success : function(res) {
//                        console.log(data);
                        var data = $.parseJSON(res);
                        if(data.success){
                            layer.alert("解冻成功！" , function() {
                                refresh();
                            });
                        }else{
                            layer.alert(data.msg , {title:'警告' , icon : 2});
                        }
                        layer.close(loader);
                    }
                });
            });
        }

        $(function () {

            $("#so_payTimeStar").datebox({
                formatter:function(date){
                    var y = date.getFullYear();
                    var m = date.getMonth()+1;
                    var d = date.getDate();
                    return y+'-'+m+'-'+d;
                },
                onSelect:function(dateselect){
                    //enddate清空
                    $('#so_payTimeEnd').datebox('setValue', '');
                    $("#so_payTimeEnd").datebox("calendar").calendar({
                        validator: function(date){
                            return dateselect <= date;
                        }
                    });
                }
            });

            $("#so_payTimeEnd").datebox({
                formatter: function (date) {
                    var y = date.getFullYear();
                    var m = date.getMonth() + 1;
                    var d = date.getDate();
                    return y + '-' + m + '-' + d;
                }
            });

            $("#so_thawTimeStar").datebox({
                formatter:function(date){
                    var y = date.getFullYear();
                    var m = date.getMonth()+1;
                    var d = date.getDate();
                    return y+'-'+m+'-'+d;
                },
                onSelect:function(dateselect){
                    //enddate清空
                    $('#so_thawTimeEnd').datebox('setValue', '');
                    $("#so_thawTimeEnd").datebox("calendar").calendar({
                        validator: function(date){
                            return dateselect <= date;
                        }
                    });
                }
            });

            $("#so_thawTimeEnd").datebox({
                formatter: function (date) {
                    var y = date.getFullYear();
                    var m = date.getMonth() + 1;
                    var d = date.getDate();
                    return y + '-' + m + '-' + d;
                }
            });
        });


        function checkPay(payNumber) {
            if(payNumber) {
                top.addTab('线上支付对账' , '/pingan/busOperationList.do?so_payNumber='+payNumber);
            }
        }
    </script>

    <style>
        /*#analysisList {max-height: 450px;overflow: auto}*/
        #anaTable {min-width: 100px;}
        #anaTable td{text-align: center}
        .aui_content{max-height: 400px;overflow: auto;}
    </style>
</head>

<body>
<div class="panel panel-info panel-content" style="overflow: auto;">
    <div class="panel-heading">
        <form  id="soform" method="post"  >
            <table >
                <tr>
                    <td class="w80" style="padding-top: 5px">
                        <label  class="center-block">买家名称：</label>
                    </td>
                    <td class="w120 ">
                        <input type="text" class="form-control" name="so_buyerName" value="${so_buyerName!}" id="so_buyerName" placeholder="买家名称" >
                    </td>
                    <td class="w80" style="padding-top: 5px">
                        <label  class="center-block">卖家名称：</label>
                    </td>
                    <td class="w120 ">
                        <input type="text" class="form-control" name="so_sellerName" value="${so_sellerName!}" id="so_sellerName" placeholder="卖家名称" >
                    </td>
                    <td class="w80" style="padding-top: 5px">
                        <label  class="center-block">订单编号：</label>
                    </td>
                    <td class="w120 ">
                        <input type="text" class="form-control" name="so_orderNumber" value="${so_orderNumber!}" id="so_orderNumber" placeholder="订单编号" >
                    </td>
                    <td class="w80" style="padding-top: 5px">
                        <label  class="center-block">支付流水号：</label>
                    </td>
                    <td class="w120 ">
                        <input type="text" class="form-control" name="so_payNumber" value="${so_payNumber!}" id="so_payNumber" placeholder="支付流水号" >
                    </td>
                </tr>
                <tr>
                    <td class="w80" style="padding-top: 5px">
                        <label  class="center-block">支付日期：</label>
                    </td>
                    <td class="w120 ">
                        <input  name="so_payTimeStar" id="so_payTimeStar"   value="${so_payTimeStar!}"  style="width:90px;"  > -
                        <input  name="so_payTimeEnd"   id="so_payTimeEnd"     value="${so_payTimeEnd!}"    style="width:90px;"  >
                    </td>
                    <td class="w80" style="padding-top: 5px">
                        <label  class="center-block">解冻日期：</label>
                    </td>
                    <td class="w120 ">
                        <input  name="so_thawTimeStar" id="so_thawTimeStar"   value="${so_thawTimeStar!}"  style="width:90px;"  > -
                        <input  name="so_thawTimeEnd"   id="so_thawTimeEnd"     value="${so_thawTimeEnd!}"    style="width:90px;"  >
                    </td>
                    <td class="w80" style="padding-top: 5px">
                        <label  class="center-block">批次类型：</label>
                    </td>
                    <td class="w120 ">
                        <select class="form-control"  id="so_batchType" name="so_batchType"  >
                            <option   value=""  >请选择</option>
                            [#list allTypes?keys as key ]
                                <option value="${key}"  [#if so_batchType?? && so_batchType==key ] selected="selected"  [/#if]  >${allTypes[key]}</option>
                            [/#list]
                        </select>
                    </td>
                    <td class="w80"></td>
                    <td class="w120">
                        <button class="btn btn-default" type="button" onclick="sosuo()" style="float: right;">搜索</button>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <table class="table table-hover table-bordered table-striped table-condensed">
        <thead>
        <tr>
            <th>序号</th>
            <th>订单编号</th>
            <th>支付流水号</th>
            <th>买家名称</th>
            <th>卖家名称</th>
            <th>冻结金额</th>
            <th>安装币</th>
            <th>批次类型</th>
            <th>支付时间</th>
            <th>支付状态</th>
            <th>操作</th>
            <th>解冻时间</th>
        </tr>
        </thead>
        [#list pagination.list as pay ]
        <tr>
            <td>${pagination.pageSize * (pagination.pageNo-1)+pay_index+1}</td>
            <td>${pay.orderNumber!}</td>
            <td style="cursor: pointer" onclick="checkPay('${pay.payNumber!}');">${pay.payNumber!}</td>
            <td>${pay.buyerCompanyName!}</td>
            <td>${pay.sellerCompanyName!}</td>
            <td>${(pay.totalPrice!0) - (pay.dePrice!0)}</td>
            <td>${pay.dePrice!}</td>
            <td>
                [#if pay.batchType = 1]<span style="color:red;">首付款</span>[#elseif pay.batchType = 2]<span style="color:blue;">尾款</span>[#else]普通[/#if]
            </td>
            <td>[#if pay.reviewtime??]${pay.reviewtime?datetime}[/#if]</td>
            <td>
                [#if pay.payState == 1]<span style="color:red;">未解冻</span>[/#if]
                [#if pay.payState == 3]已解冻[/#if]
                [#if pay.payState == 2]未复核[/#if]
            </td>
            <td style="/*max-width: 150px;*/">
                [#if pay.payState == 1]<button type="button" class="btn   btn-xs  btn-default" onclick="thaw('${pay.payNumber!}');return false;" >解冻</button>[/#if]
            </td>
            <td>[#if pay.thawtime??]${pay.thawtime?datetime}[/#if]</td>
        </tr>
        [/#list]
    </table>

    <div class="panel-footer">[@fenye p = pagination form = 'infoForm' /]</div>
</div>
</body>
</html>